package edu.stanford.bmir.protege.web.client.rpc.stkosutil.common;

import java.util.Comparator;

import edu.stanford.bmir.protege.web.client.rpc.data.EntityData;

public class EntityDataComparator implements Comparator<EntityData> {

	@Override
	public int compare(EntityData entityData, EntityData entityData2) {
		 String browserText1 = entityData.getBrowserText();
         String browserText2 = entityData2.getBrowserText();
         if (browserText1 == null) {
             if(browserText2 == null) {
                 return 0;
             }
             else {
                 return 1;
             }
         }
         else if(browserText2 == null) {
             return -1;
         }
//         if(browserText1.equalsIgnoreCase(normalizedSearchString)) {
//             return -1;
//         }
//         else if(browserText2.equalsIgnoreCase(normalizedSearchString)) {
//             return 1;
//         }
         return browserText1.compareToIgnoreCase(browserText2);
	}

}
